package com.hightrast.service.config;

import org.springframework.context.annotation.Configuration;


//@EnableTransactionManagement
@Configuration
public class MyBatisConfig {

//    @Value("${mybatis-plus.mapper-locations}")
//    private String mapperLocations;
//
//    @Value("${mybatis-plus.typeAliasesPackage}")
//    private String typeAliasesPackage;

//    @Bean
//    public MybatisPlusInterceptor mybatisPlusInterceptor() {
//        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
//        paginationInnerInterceptor.setOptimizeJoin(true);
//        paginationInnerInterceptor.setOverflow(true);
//        interceptor.addInnerInterceptor(paginationInnerInterceptor);
//        OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor = new OptimisticLockerInnerInterceptor();
//        interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor);
//        return interceptor;
//    }
//
//    @Bean
//    public SqlSessionFactory sqlSessionFactory(DataSource dataSource,MybatisPlusInterceptor mybatisPlusInterceptor) throws Exception {
//        MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
//        sessionFactory.setDataSource(dataSource);
//        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
//        sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
//        sessionFactory.setPlugins(new Interceptor[]{mybatisPlusInterceptor});
//        return sessionFactory.getObject();
//    }
//
//    @Bean
//    public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }



}